const url = require('url');
// const str = url.parse('http://www.test.com/aa?name=1&pass=1');
// console.log(str);

{
    protocol: 'http:',
    slashes: true,
    auth: null,
    host: 'www.test.com',
    port: null,
    hostname: 'www.test.com',
    hash: null,
    search: '?name=1&pass=1',
    query: 'name=1&pass=1',
    pathname: '/aa',
    path: '/aa?name=1&pass=1',
    href: 'http://www.test.com/aa?name=1&pass=1'
}

const str1 = url.parse('http://www.test.com/aa?name=1&pass=1', true);
console.log(str1);

{
    protocol: 'http:',
    slashes: true,
    auth: null,
    host: 'www.test.com',
    port: null,
    hostname: 'www.test.com',
    hash: null,
    search: '?name=1&pass=1',
    query: {
        name: '1',
        pass: '1'
    },
    pathname: '/aa',
    path: '/aa?name=1&pass=1',
    href: 'http://www.test.com/aa?name=1&pass=1'
}